UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A8XoFP22uIihBe1DPVH9IjVE26sa/K3qDYPfo8vYh+Y='
WHERE
key_id = '5cae7bba476695b88a61e25b523488fac8329e926a6379b3b843e9ecb1b4bb0b'
AND (
token = 'A8XoFP22uIihBe1DPVH9IjVE26sa/K3qDYPfo8vYh+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)