UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pNgoOXtF1ueNwsotJbAqVVnBC6FXorBWpSFk/ODFhvY=' 
WHERE 
  key_id = '511b490c04db3d20ce160520ee6e174f283e58c3d79fc772b7b1cba88c97234a' 
  AND (
    token = 'pNgoOXtF1ueNwsotJbAqVVnBC6FXorBWpSFk/ODFhvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035