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