UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sQBuIcqtFqFkWljiK0MU+SQTlKFQ5S+0xXMZjm5LanQ='
WHERE
key_id = '8d639e9b39d38a399b1622f64f8afa4c057b50607f7eac6e2d02dae2ae99f39a'
AND (
token = 'sQBuIcqtFqFkWljiK0MU+SQTlKFQ5S+0xXMZjm5LanQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)