UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RA+Wghxefa44oT/Xht2P9BOlT4+VYeJzZ7KgMUgSE38='
WHERE
key_id = 'f8877e298d923b24027883ad862ebff098ba6eb3aacf7ee676f2fc40047e738b'
AND (
token = 'RA+Wghxefa44oT/Xht2P9BOlT4+VYeJzZ7KgMUgSE38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)