UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gzw/hX7l7S0DEOW0MWYryYCpqq43F4W8OewlYXK2wRs='
WHERE
key_id = 'cdd3932cb64d4ec24e6063810e571d155d963e9194711e7006b7ca8776d350c0'
AND (
token = 'Gzw/hX7l7S0DEOW0MWYryYCpqq43F4W8OewlYXK2wRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)