UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAJHd4Cjamz5Afn+BPpAIiLcITF/3jW15VGoXg01qZk=' 
WHERE 
  key_id = '97f3eac2d6afe976a1b6e1c35468cec85cafb265f00ff01ffae7feb08bc62e59' 
  AND (
    token = 'dAJHd4Cjamz5Afn+BPpAIiLcITF/3jW15VGoXg01qZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036