UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eT6QwAKyibUOzklnAG+2F6E0TVGhOuRusHBbwTQEOGg=' 
WHERE 
  key_id = 'd27963b999cb9c76985b523f259e7efa1112fddd9a442a64917e5fddccf63dee' 
  AND (
    token = 'eT6QwAKyibUOzklnAG+2F6E0TVGhOuRusHBbwTQEOGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023