UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NeWg047clAFT6lK0ncRyQP3XdGP7JGhjlHSil/044rA=' 
WHERE 
  key_id = 'baa97dd2f8cadfd9d4b6ac300322e3bc10a4ab0373cf821610a985ac99b7012f' 
  AND (
    token = 'NeWg047clAFT6lK0ncRyQP3XdGP7JGhjlHSil/044rA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061