UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtOQBkKyTJwHjMkIWeK3rOWUPpqmpvzYYUSQNfTqmhM=' 
WHERE 
  key_id = '23aad25ab2ba001b6fe23dd52998280b3103e85f8f91931c5e38d366898d6e82' 
  AND (
    token = 'NtOQBkKyTJwHjMkIWeK3rOWUPpqmpvzYYUSQNfTqmhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024