UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cDBePxbZPNsNK8FA9SiVjwGxqUiq0PvmTTNb5vPUzco='
WHERE
key_id = 'de2c813c90954733288a1fcf060881e606354cce6fc3f9c15ed29246b85016dc'
AND (
token = 'cDBePxbZPNsNK8FA9SiVjwGxqUiq0PvmTTNb5vPUzco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)