UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dBwwn3Y1f3eP0ruoC0/KVZOzbef0e9D/S0exc+S+j8k='
WHERE
key_id = '3b1145a022a5e8a858e686a3b77f81e4486901f5b598885a695cfa3b23df27f1'
AND (
token = 'dBwwn3Y1f3eP0ruoC0/KVZOzbef0e9D/S0exc+S+j8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)