UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ypm5qM2rNlx5LnG4Ip4CdKi7qc9RC9ra9edCqzRMG9s='
WHERE
key_id = '835f3c16a9ab2e348499f7bc6bcb3fe3cd1485203af94d87459b7ffda78c23ab'
AND (
token = 'Ypm5qM2rNlx5LnG4Ip4CdKi7qc9RC9ra9edCqzRMG9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)