UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NYvUqA+F8KJZjBWOJDiZyIE+Okj25i3AF+rmA82DK/o='
WHERE
key_id = '27ccbcb63c5a4e5d540f5c78146abf0ebb830def24986be51b4bba4ee80565da'
AND (
token = 'NYvUqA+F8KJZjBWOJDiZyIE+Okj25i3AF+rmA82DK/o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)