UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lSfKCPmUZq2wECtbS3YztiClW0fGjSK4OAer3t3gSeI='
WHERE
key_id = 'ebbda0887852b88ae45f929235fb57a3e046105100776eb0061a608fdd71369d'
AND (
token = 'lSfKCPmUZq2wECtbS3YztiClW0fGjSK4OAer3t3gSeI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)