UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W4u6TBNrerLrHhPByj2LgvqnzbxMjTG6XDqIdmI2vy4='
WHERE
key_id = '0e252f6fae5e8b8029b2513554f52b076cce495fd00840e440f510a14a1ff818'
AND (
token = 'W4u6TBNrerLrHhPByj2LgvqnzbxMjTG6XDqIdmI2vy4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)