UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tTY8qQaIqmb89M5vgrwhj+YtOKexUdkf6KsRQGtzdfA=' 
WHERE 
  key_id = '9f4975ae3e5f2c602f7f644291de3f1a438a2aa4078d77b78db515879679261e' 
  AND (
    token = 'tTY8qQaIqmb89M5vgrwhj+YtOKexUdkf6KsRQGtzdfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021