UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C48UV4iRAmB7h2SkNjNZftUyUea+T4Pl0dVSxgpYBC8=' 
WHERE 
  key_id = '48335be176c94f44e55e85a5cdf67ec3d3a0329056d724e0bc2864b343d91286' 
  AND (
    token = 'C48UV4iRAmB7h2SkNjNZftUyUea+T4Pl0dVSxgpYBC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035