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