UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J31UkDXV6pM+Rg20hyuuk0cP6chuHOpgDjA56dhVr04=' 
WHERE 
  key_id = '13f5fe69606711d75299f6cabdab8f5d2c5a24cf3934be8dd27b1d1a855bdc16' 
  AND (
    token = 'J31UkDXV6pM+Rg20hyuuk0cP6chuHOpgDjA56dhVr04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033