UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8emr0R+AB8GT/uG0tvbPJCWdX9o0wuFr+boGZzQqWTk='
WHERE
key_id = 'b22f76405f16230c5bdf23fa71b9c615aea3ec533d844c5de411574fb289f8bc'
AND (
token = '8emr0R+AB8GT/uG0tvbPJCWdX9o0wuFr+boGZzQqWTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)