UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sU7Q0FRDP7ETcDRZZt5exdQ9B+Zzr9jOA4cGG5Kb5O8='
WHERE
key_id = '03374a56103ae84d6a7395f03f61817e110c025b828e7f7ab59df2a24c1145e8'
AND (
token = 'sU7Q0FRDP7ETcDRZZt5exdQ9B+Zzr9jOA4cGG5Kb5O8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)