UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pH793HMuyFT3BG7Iqy7453b38uegulxTWuZLY7CFCbU=' 
WHERE 
  key_id = '951fac8f104b3e42c96a1674b5ecf1bfe8e87ed5997ef5151da15072ab072ecb' 
  AND (
    token = 'pH793HMuyFT3BG7Iqy7453b38uegulxTWuZLY7CFCbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034