UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ST0UzTr7Yd1N22a8PZ1bkLr50gbGejaXAZv55I01cV8=' 
WHERE 
  key_id = 'f4168b8706178d0173cbdf48ea1019923abfe096b937759e76f0ca1a388d544d' 
  AND (
    token = 'ST0UzTr7Yd1N22a8PZ1bkLr50gbGejaXAZv55I01cV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016