UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5pLfiWmsXlfXG2/ATE5214VzWe7h2PqxZwf16+y+jEI=' 
WHERE 
  key_id = '97fefd4397fef8460acbb8b718d198d99a13a5d6567769e739f0a1264e83b11e' 
  AND (
    token = '5pLfiWmsXlfXG2/ATE5214VzWe7h2PqxZwf16+y+jEI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034