UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sA3Frx6WruuU2VpJQCewmEYxTGXpio0Ttj+WISfkIsU=' 
WHERE 
  key_id = '109e158cb62f9f96afce2beb1ed247df143906f8d599e9455995a41914861440' 
  AND (
    token = 'sA3Frx6WruuU2VpJQCewmEYxTGXpio0Ttj+WISfkIsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039