UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NcDGuQfyrPA7z7K30/8ZIetBP5nGkP9iN1vZrwt8kac='
WHERE
key_id = 'c6ddd722a76ae837ad043e47bddee72256a4a838aa133d10a2c8ded99fb3c114'
AND (
token = 'NcDGuQfyrPA7z7K30/8ZIetBP5nGkP9iN1vZrwt8kac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)