UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RyEFpZp0tUc/gIRooqtPC9VFUb+X1IFY+UioAIpFnn0=' 
WHERE 
  key_id = '154122878ca51036910e37b37a46970bbdd2307564defd245a35eca2f460b020' 
  AND (
    token = 'RyEFpZp0tUc/gIRooqtPC9VFUb+X1IFY+UioAIpFnn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046