UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aVBztUpZgJ1Pdw5avvUjzQSIwwnxW7bhimb6R+bNeIY='
WHERE
key_id = '1c1896d46e0aef2c20c621182defdc83951db23130a1923e044e48d8c6f9ce03'
AND (
token = 'aVBztUpZgJ1Pdw5avvUjzQSIwwnxW7bhimb6R+bNeIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)