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