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