UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd4lKZP5VYqngSaVQUcLchzam/kHA0ubZb3CIffDE+A4='
WHERE
key_id = 'e660afb439a6fa938ea76a2c417debc3b099937e16e1a8b2832149c07dcbf5e4'
AND (
token = 'd4lKZP5VYqngSaVQUcLchzam/kHA0ubZb3CIffDE+A4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)