UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lPUMe9HZGoaqPSy+IAE1xc5jADYk2cBJKf7mk7l90ok='
WHERE
key_id = 'e6cf842551fe9122e60791027f5fd467737c1f1580a8cb7a5e30951b3a581d15'
AND (
token = 'lPUMe9HZGoaqPSy+IAE1xc5jADYk2cBJKf7mk7l90ok='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)