UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UFf6s7drjjVBX+MD4xjmtb3Xx0dGQ4tS2XWaZMyFo18='
WHERE
key_id = 'a5807ec6e7d821e6d887aebc8284a59127c3274533e555ecc2a997b9c431550c'
AND (
token = 'UFf6s7drjjVBX+MD4xjmtb3Xx0dGQ4tS2XWaZMyFo18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)