UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7wKv68nA7XK17pH7pwXuq1oPHPt03/6rcHUaqFykgNM=' 
WHERE 
  key_id = 'b4423df34b52bce822643208729478b7fb2425ae4886c0048176d48e0cdf40a5' 
  AND (
    token = '7wKv68nA7XK17pH7pwXuq1oPHPt03/6rcHUaqFykgNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038