UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VxBqy7i0KGWW9/GBYf9nNpEMNQDMS1eiBA7rpvZbDws='
WHERE
key_id = '398a8e7978e8fee95cf7ddb3b0966118905091ad56896e341c53415b5f1c6013'
AND (
token = 'VxBqy7i0KGWW9/GBYf9nNpEMNQDMS1eiBA7rpvZbDws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)