UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FFSDTNQcQZDSVPI5580MgujVlnmq4T7nf2KstIJTaE0=' 
WHERE 
  key_id = '09e2aa49b5bf48ec564f0cc30d062f9450f82e8397cb21dad290678e551a152e' 
  AND (
    token = 'FFSDTNQcQZDSVPI5580MgujVlnmq4T7nf2KstIJTaE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025