UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uO43fCi3Sb+Ub/BIkR/eIDU4N0cRuyA4GeGgYePQK9I='
WHERE
key_id = 'bbc657424b1369b5bb7dea31091d211c6e40a95fe4cf527a520e122eced64ee7'
AND (
token = 'uO43fCi3Sb+Ub/BIkR/eIDU4N0cRuyA4GeGgYePQK9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)