UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NT29WThTpmIcAWhgg8zqSdoryGviXMbLqNTAOluy0ZI=' 
WHERE 
  key_id = '76298af8fe56d7282448afa04b874e7dd0b26758113ac85c9ac78e28840264c0' 
  AND (
    token = 'NT29WThTpmIcAWhgg8zqSdoryGviXMbLqNTAOluy0ZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028