UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a47Mn17SxE1BOSvUY27BZMMO2ICOiuoeCOaJdJAp7Vg='
WHERE
key_id = '2be8cb3b3a66f7aa429ce49e397d4025a55298b51aa4140ad5b903a795c73dfe'
AND (
token = 'a47Mn17SxE1BOSvUY27BZMMO2ICOiuoeCOaJdJAp7Vg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)