UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NLfty+BP13IFN2ixvFmjRxNe3gfpHm6BZdNXuKPXzIs=' 
WHERE 
  key_id = '5632a9ef61119f7dfcc92f56d64c0cc5bec9451f2a0a4207abb16b03987e91a8' 
  AND (
    token = 'NLfty+BP13IFN2ixvFmjRxNe3gfpHm6BZdNXuKPXzIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047